from django.db import models

# Create your models here.
class Logs(models.Model):
    method = models.CharField(max_length=32, verbose_name='请求方式',help_text='请求方式')
    user_id = models.CharField(max_length=32, verbose_name='用户',help_text='用户')
    url = models.CharField(max_length=128, verbose_name='url',help_text='url')
    desc = models.CharField(max_length=128, verbose_name='描述',help_text='描述')
    ip = models.CharField(max_length=32, verbose_name='ip',help_text='ip')
    success = models.BooleanField(verbose_name='是否成功',help_text='是否成功')
    user_agent = models.CharField(max_length=256, verbose_name='user_agent',help_text='user_agent')
    ca_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间', help_text='创建时间')
    up_time = models.DateTimeField(auto_now=True,verbose_name='更新时间',help_text='更新时间')

    class Meta:
        db_table = 'logs'

class Dictionary(models.Model):
    name = models.CharField(max_length=32, verbose_name='字典名称',help_text='字典名称')
    code = models.CharField(max_length=32, verbose_name='字典编码',help_text='字典编码')
    enable = models.BooleanField(verbose_name='是否启用',help_text='是否启用')
    parent_id = models.ForeignKey('Dictionary',on_delete=models.CASCADE, null=True, blank=True,verbose_name='父级字典',help_text='父级字典')
    remark = models.CharField(max_length=128, verbose_name='备注',help_text='备注',null=True,blank=True)
    ca_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间', help_text='创建时间')
    up_time = models.DateTimeField(auto_now=True,verbose_name='更新时间',help_text='更新时间')

    class Meta:
        db_table = 'dictionary'

class File(models.Model):
    name = models.CharField(max_length=32, verbose_name='文件名称',help_text='文件名称')
    path = models.CharField(max_length=128, verbose_name='文件路径',help_text='文件路径')
    size = models.IntegerField(verbose_name='文件大小',help_text='文件大小')
    type = models.CharField(max_length=32, verbose_name='文件类型',help_text='文件类型')
    ca_by= models.IntegerField(verbose_name='创建人',help_text='创建人')
    ca_time= models.DateTimeField(auto_now_add=True, verbose_name='创建时间', help_text='创建时间')
    up_time = models.DateTimeField(auto_now=True,verbose_name='更新时间',help_text='更新时间')

    class Meta:
        db_table = 'file'